fix(build): commit ui/dist/ so go install ships a working web UI#96
Closed
fix(build): commit ui/dist/ so go install ships a working web UI#96
go install ships a working web UI#96Conversation
The Go //go:embed ui/dist directive needs the real built SPA assets present at compile time. Until now the gitignore excluded ui/dist/* except for a placeholder index.html, which meant `go install github.com/RandomCodeSpace/docsiq@vX.Y.Z` produced a binary that served the placeholder + 404'd on every /assets/* request. Release binaries on GitHub were unaffected (CI runs `npm run build` before `go build`), but `go install` users got a broken UI. Fix: - .gitignore: drop the `ui/dist/*` exception so dist contents are committed; comment now documents the workflow (`npm run build` and commit before tagging). - Commit the current `npm run build` output (assets/, fonts/, manifest.webmanifest, sw.js, icons, refreshed index.html). 1.2 MB total; ~27 files. Verified: a fresh `go build` against this tree produces a binary that returns HTTP 200 for every /assets/<hashed>.js and /assets/<hashed>.css path the index.html references. Workflow note: future UI source changes must be paired with `npm run build` + `git add ui/dist/` before tagging a release. CI also re-runs `npm run build` so the release binaries always reflect the latest UI tree, but the committed dist is what `go install` users receive.
Contributor
Author
|
Closing in favour of a release-time approach: the release workflow will commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Without committed
ui/dist/assets,go install github.com/RandomCodeSpace/docsiq@vX.Y.Zproduces a binary that serves the placeholderindex.htmland 404s on every/assets/*request — because Go's//go:embed ui/distdirective can only embed files actually present in the source tree (which is whatproxy.golang.orgmirrors).This PR commits the built dist and updates the gitignore + workflow.
Changes
.gitignore— replaces theui/dist/*re-ignore with!ui/dist/**. Comment updated to explain why dist is now committed and to call out thenpm run build+git add ui/dist/step that must happen before tagging.ui/dist/{assets,fonts,...}— freshnpm run buildoutput committed. ~27 files, 1.2 MB total.Verified
make buildclean.go build -tags sqlite_fts5 -o ./docsiq .against this branch produces a binary that, onserve, returns HTTP 200 for every/assets/<hash>.jsand/assets/<hash>.cssreferenced byui/dist/index.html.Trade-off documented
Every UI source change now requires running
npm run buildand committing the regeneratedui/dist/alongside the source diff (asset hashes change with content). This is the price of keepinggo installworking as a first-class install path.Test plan
ci,codeql,playwright,securitygo install github.com/RandomCodeSpace/docsiq@v0.1.5(or whatever the next tag is) followed bydocsiq serveproduces a UI where every asset loads